package com.ruoyi.web.controller.orderManage;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.GuestRoom;
import com.ruoyi.system.domain.OrderManage;
import com.ruoyi.system.mapper.GuestRoomMapper;
import com.ruoyi.system.service.GuestRoomService;
import com.ruoyi.system.service.OrderManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/system/guestRoom")
public class GuestRoomController extends BaseController {


    @Autowired
    private GuestRoomService GuestRoomService;


    @PreAuthorize("@ss.hasPermi('system:guestRoom:list')")
    @GetMapping("/list")
    public TableDataInfo list(GuestRoom guestRoom)
    {
        startPage();
        List<GuestRoom> list = GuestRoomService.selectGuestRoomList(guestRoom);
        return getDataTable(list);
    }

    @PreAuthorize("@ss.hasPermi('system:guestRoom:add')")
    @PostMapping("/add")
    public AjaxResult add(@RequestBody GuestRoom guestRoom)
    {
        return toAjax(GuestRoomService.insertGuestRoom(guestRoom));
    }

    @PreAuthorize("@ss.hasPermi('system:guestRoom:update')")
    @PostMapping("/update")
    public AjaxResult update(@RequestBody GuestRoom guestRoom)
    {
        return toAjax(GuestRoomService.updateGuestRoom(guestRoom));
    }

    @PreAuthorize("@ss.hasPermi('system:guestRoom:delete')")
    @PostMapping("/delete")
    public AjaxResult delete(@RequestBody String numberId)
    {
        return toAjax(GuestRoomService.deleteGuestRoom(numberId));
    }
}
